time: 2021.3
# -*- coding: utf-8 -*-
# @Time    : 2021/3/21 12:36
# @Author  : luogan
# @Email   : 468640092@qq.com
# @File    : 2021.3.21罗干作业--猜数字.py
# @Software: PyCharm.

b = 5
for i in range(1,4):
    a = input("请输入一个数字:")
    if a.isdigit():
        a = int(a)
        if a>b:
            print(f"大,你猜的数字偏大,猜了{i}次,请重新猜!")
        elif a<b:
            print(f"小,你猜的数字偏小,猜了{i}次,请重新猜!")
        elif a==b:
            print(f"你猜对了，猜了{i}次")
            break
    else:
        print("你输入的格式不正确！")
    if i==3:
        print("=======================")
        print("您猜的机会已经用光了")
        break


